package com.financing.wap.web.controller.api;

import com.alibaba.fastjson.JSON;
import com.financing.common.dto.AaaDTO;
import com.financing.common.service.IAaaService;
import com.financing.common.util.WhereCondition;
import com.financing.wap.util.AjaxUtils;
import com.financing.wap.web.controller.BaseController;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller("apiAaaController")
@RequestMapping("/api/aaa")
public class AaaController extends BaseController {
    Logger logger = Logger.getLogger(getClass());

    @Autowired
    IAaaService aaaService;

    @RequestMapping(value = "/query")
    public void  query(HttpServletRequest request, HttpServletResponse response){
        response.setContentType("application/json; charset=UTF-8");
        WhereCondition whereCondition = WhereCondition.WhereConditionBuild.build();
        List<AaaDTO> list = aaaService.query(whereCondition);
        AjaxUtils.ajaxJson(response, JSON.toJSONString(list));
    }

}
